Add to_rsa_format function to normalize private key#56
Merged
cmcinnes-mdsol merged 6 commits intomainfrom Dec 16, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new utility function to normalize private keys into RSA format and updates the authentication clients to support reading configuration from environment variables. The changes improve flexibility by allowing credentials to be provided via multiple environment variable names and ensuring private keys are properly formatted.
Key changes:
- New
to_rsa_formatutility function handles private keys with various formatting (missing newlines, spaces instead of newlines, or no formatting) - Both
MAuthHttpxandMAuthclients now accept default values from environment variables viaConfig - Environment variable support expanded to include
MAUTH_APP_UUIDandMAUTH_PRIVATE_KEYas alternatives
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| mauth_client/utils.py | Implements to_rsa_format function to normalize private key formatting with proper headers, footers, and newlines |
| mauth_client/config.py | Updates environment variable loading to use to_rsa_format and support alternative variable names |
| mauth_client/requests_mauth/client.py | Changes constructor to accept default values from Config for app_uuid and private_key_data |
| mauth_client/httpx_mauth/client.py | Changes constructor parameters to use Config defaults for app_uuid and private_key_data |
| tests/utils_test.py | Adds comprehensive test coverage for the new to_rsa_format function |
| tests/httpx_mauth/client_test.py | Refactors tests to use shared key loading utility instead of inline file reading |
| README.md | Documents new environment variable options and fixes table formatting |
| CHANGELOG.md | Documents the new features in version 1.8.0 |
| pyproject.toml | Bumps version to 1.8.0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
also, update requests_mauth and httpx_mauth to support reading configuration from environment variables